gusucode.com > 现代通信系统——使用MATLAB(+全部程序) > 现代通信系统——使用MATLAB(+全部程序)/现代通信系统——使用MATLAB(+全部程序)/Matlab 程序/Chapter6/ip_06_04.m
% MATLAB script for Illustrative Problem 6.4. echo on Length=101; Fs=10000; W=2000; Ts=1/Fs; n=-(Length-1)/2:(Length-1)/2; t=Ts*n; h=2*W*sinc(2*W*t); % The rectangular windowed version follows. N=61; rec_windowed_h=h((Length-N)/2+1:(Length+N)/2); % Frequency response of rec_windowed_h follows. [rec_windowed_H,W1]=freqz(rec_windowed_h,1); % to normalize the magnitude rec_windowed_H_in_dB=20*log10(abs(rec_windowed_H)/abs(rec_windowed_H(1))); % The Hanning windowed version follows. hanning_window=hanning(N); hanning_windowed_h=h((Length-N)/2+1:(Length+N)/2).*hanning_window.'; [hanning_windowed_H,W2]=freqz(hanning_windowed_h,1); hanning_windowed_H_in_dB=20*log10(abs(hanning_windowed_H)/abs(hanning_windowed_H(1))); % Plotting commands follow.